// 数组去重
type snarray = string[] | number[]

const testDrArrayTs:snarray = [1,1,2,2,3,4,5,6,6]

// 方法一，通过遍历实现
const drArray1Ts = (arr:snarray):snarray => {
  const res:snarray = []
  // 遍历数组每个元素，用indexOf判断是否存在于res中，不存在则推入
  arr.forEach((element: any) => {
    res.indexOf(element as never) < 0 && res.push(element as never)
  });
  return res
}

// 用es6的set类型一行解决
const drArray2Ts = (arr:snarray) => [...new Set(arr as never)]

console.log(drArray2Ts(testDrArrayTs))